//package io.renren.modules.app.message.handler;
//
//import cn.hutool.core.thread.ThreadUtil;
//import cn.hutool.core.util.ObjectUtil;
//import cn.hutool.core.util.StrUtil;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import io.renren.modules.app.message.MessageResult;
//import io.renren.modules.app.message.MsgType;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.ApplicationContext;
//import org.springframework.stereotype.Component;
//
///**
// * @author :
// * @version V1.0
// * @Project:
// * @Package
// * @Description:
// * @date
// **/
//@Component(PayMessageHandler.BeanName)
//@Slf4j
//public class PayMessageHandler extends AbstractJdVopMessageHandler {
//    public final static String BeanName="MessagePayHandle";
//
//    private static Integer FAILED=0;
//    private static Integer EXCEED_7D=0;
//    private static Integer COUNT=0;
//
////    @Autowired
////    private IOmsOrderService omsOrderService;
//
//    public PayMessageHandler(ApplicationContext applicationContext) {
//        super(applicationContext);
//        this.setBeanName(BeanName);
//    }
//
//    @Override
//    public void read(MessageResult msg) {
//        ++FAILED;
//        System.out.println("支付消息");
////        int type=msg.getType();
////        switch (type){
////            case MsgType.Pay.FAILED:
////                ThreadUtil.execute(()-> handlePlayFailed(msg));
////                break;
////            case MsgType.Pay.EXCEED_7D:
////                ThreadUtil.execute(()-> handleExceed7dOrder(msg));
////                break;
////            default:
////                log.info("JD_VOP NOT FOUND FUN：{}",msg);
////                notifyMsgReadEvent(msg,false);
////        }
//    }
//
//    /**
//     * 支付失败
//     * @param msg
//     */
//    private void handlePlayFailed(MessageResult msg){
//        String jdOrderId=getMsg(msg,MessageResult.orderId);
//        log.warn("JD_VOP={},订单支付失败,",jdOrderId);
//        //发送短信即可
//        notifyMsgReadEvent(msg,true);
//    }
//
//    /**
//     * 7天未支付取消消息/未确认取消消息
//     * @param msg
//     */
//    private void handleExceed7dOrder(MessageResult msg){
////       OmsOrder omsOrder= getOmsOrder(msg);
////       boolean flag=true;
////       String cancelType=getMsg(msg,MessageResult.cancelType);
////       if(ObjectUtil.isNotNull(omsOrder)
////               && StrUtil.isNotBlank(cancelType)
////               && !Integer.valueOf(OrderStatus.CLOSED.getValue()).equals(omsOrder.getStatus())){
////            int type= Integer.valueOf(cancelType);
////            if(type==1 && Integer.valueOf(OrderStatus.INIT.getValue()).equals(omsOrder.getStatus())){//cancelType, 1: 7天未支付取消消息; 2: 未确认取消
////                flag = this.updateOrderStatus(omsOrder.getOutOrderSn(), OrderStatus.CLOSED.getValue());
////            }else if(type==2){
////                log.warn("JD_VOP=[{}],7天未确认取消信息",omsOrder.getOutOrderSn());
////                //假如用户支付了；未确认？
////                flag = this.updateOrderStatus(omsOrder.getOutOrderSn(), OrderStatus.CLOSED.getValue());
////            }
////       }
////       notifyMsgReadEvent(msg,flag);
//    }
//
////    public OmsOrder getOmsOrder(MessageResult msg) {
////        String jdOrderId = getMsg(msg, MessageResult.orderId);
////        return getOneByOutOrderSn(jdOrderId);
////    }
//
//
//    /**
//     * 更新订单状态
//     * @param outOrderSn
//     * @param status
//     */
//    public boolean updateOrderStatus(String outOrderSn,Integer status){
////        if(StrUtil.isBlank(outOrderSn) || status == null || status == 0) return true;
////        return this.omsOrderService.update(Wrappers.<OmsOrder>lambdaUpdate().set(OmsOrder::getStatus,status).eq(OmsOrder::getOutOrderSn,outOrderSn));
//        return true;
//    }
//
//
//    /**
//     * 根据京东订单号获取订单
//     * @param outOrderSn
//     * @return
//     */
////    private OmsOrder getOneByOutOrderSn(String outOrderSn){
////        return this.omsOrderService.getOne(Wrappers.<OmsOrder>lambdaQuery().eq(OmsOrder::getOutOrderSn,outOrderSn));
////    }
//
//}
